Skip to content

Comments

gh-144837: Improve documentation for more collection methods#144841

Open
serhiy-storchaka wants to merge 3 commits intopython:mainfrom
serhiy-storchaka:docs-collections-signatures
Open

gh-144837: Improve documentation for more collection methods#144841
serhiy-storchaka wants to merge 3 commits intopython:mainfrom
serhiy-storchaka:docs-collections-signatures

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Feb 15, 2026

Use uniform standard signature syntax in the tutorial and in the array and collections modules documentation.


📚 Documentation preview 📚: https://cpython-previews--144841.org.readthedocs.build/

Use uniform standard signature syntax in the tutorial and in
the array and collections modules documentation.
.. method:: append(value, /)

Append a new item with value *x* to the end of the array.
Append a new item with the specified value to the end of the array.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Append a new item with the specified value to the end of the array.
Append a new item with the specified *value* to the end of the array.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this. I tried to avoid value *value*.

Copy link
Member

@nedbat nedbat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few tweaks.



.. method:: list.index(x[, start[, end]])
.. method:: list.index(value[, start[, stop])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still has square brackets? Also, they are unbalanced.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I copied it from other place which already had such error.

As for the signature of the index() methods, this is a different issue. First, we need to decide if it needs to support None (see #138134), or this is just an unintentional implementation artifact. If yes, then we can write

list.index(value, start=None, stop=None, /)

If not, then we need to write

list.index(value, start=0, stop=sys.maxsize, /)

or use multiple signatures:

list.index(value, start=0, /)
list.index(value, start, stop, /)

This is a separate large issue.

@bedevere-app
Copy link

bedevere-app bot commented Feb 19, 2026

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Copy link
Member Author

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the requested changes; please review again.



.. method:: list.index(x[, start[, end]])
.. method:: list.index(value[, start[, stop])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I copied it from other place which already had such error.

As for the signature of the index() methods, this is a different issue. First, we need to decide if it needs to support None (see #138134), or this is just an unintentional implementation artifact. If yes, then we can write

list.index(value, start=None, stop=None, /)

If not, then we need to write

list.index(value, start=0, stop=sys.maxsize, /)

or use multiple signatures:

list.index(value, start=0, /)
list.index(value, start, stop, /)

This is a separate large issue.

@serhiy-storchaka serhiy-storchaka force-pushed the docs-collections-signatures branch from 7ac12f6 to e0fe9c7 Compare February 20, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants